package com.tedu.springmvc.controller;

import com.tedu.springmvc.pojo.dto.BmiDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BmiController {

    @RequestMapping("/bmi")
    @ResponseBody
    String findBmi(BmiDTO data){
        System.out.println(data);
        double bmi = data.getWeight()/(data.getHeight()*data.getHeight());
       if(bmi < 18.5){
           return "偏瘦,bmi为:"+bmi;
       }else if(bmi < 24){
           return "正常,bmi为:"+bmi;
       }else if(bmi < 27){
           return "微胖,bmi为:"+bmi;
       }else{
           return "该减肥了,bmi为:"+bmi;
       }
    }
}
